package com.kehong.stationtest.dao;

import com.kehong.station.dao.impl.TicketDaoImpl;
import com.kehong.station.entity.Ticket;
import org.junit.Before;
import org.junit.Test;

import java.sql.Timestamp;

/**
 * @author zhang peng yang ming
 * @CopyRight (C) http://www.csdn.com
 * @brief
 * @email 122162005@qq.com
 * @date 2018-07-10
 */
public class TicketDaoTest {
    TicketDaoImpl ticketDao = null;

    /**
     * 在执行test 之前，先调用此方法初始化 ticketDao
     */
    @Before
    public void init() {
        ticketDao = new TicketDaoImpl();
    }

    /**
     * 测试 根据 ID 查找 车票
     */
    @Test
    public void findById() {
        Ticket ticket = ticketDao.findById(1l);
        System.out.println(ticket);
    }

    @Test
    public void findAll() {
        System.out.println(ticketDao.findAll());
    }

    @Test
    public void update() {
        Ticket ticket = new Ticket(1l, new Timestamp(System.currentTimeMillis()), "茶店子客运中心", "五块石客运中心", 2, 300, 100);
        System.out.println(ticketDao.update(ticket));
    }
}
